<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<table width="100%" border="0">
<c:if test="${ticket.stati.idStato!='3' }">
	<tr>
		<td colspan="5">
		<input type="button" value="Aggiungi dettaglio"	name="aggiungiDettaglio" onclick="javascript:window.location.href='inserisciTicket.do?idTicket=<c:out value='${param.id}'/>'"/>
		</td>
	</tr>
</c:if>
<c:if test="${not empty storico}">
<tr>
					<th width="10%">Data modifica</th>
					<th width="10%">Ora modifica</th>
					<th width="40%">Descrizione</th>
					<th width="20%">Utente ultima modifica</th>
					<th width="10%"></th>
					<th width="10%">Allegati</th>
</tr>
</c:if> 
	<c:forEach items="${storico}" var="item">
		<c:choose>
			<c:when test="${item.storicoTicket.prossimaAzione==null }">
				<tr>
					<td width="10%"><fmt:formatDate value="${item.storicoTicket.dataModifica }"
						pattern="dd/MM/yyyy" /></td>
					<td width="10%"><fmt:formatDate value="${item.storicoTicket.dataModifica }"
						pattern="HH:mm" /></td>
					<td width="40%"><c:out value="${item.storicoTicket.descrizione}"></c:out></td>
					<td width="20%"><c:out
						value="${item.storicoTicket.tickets.utentiByIdUtenteUltimaModifica.cognome}"></c:out></td>
					<td width="10%">
						<c:if test="${item.modifiable && item.storicoTicket.tickets.utentiByIdUtenteUltimaModifica.idUtente==loginForm.utenti.idUtente}">
							<a href="modificaTicket.do?idTicket=<c:out value='${item.storicoTicket.tickets.idTicket }'/>&idStorico=<c:out value='${item.storicoTicket.idStorico }'/>&modifica=Y">modifica</a>
						</c:if>
					</td>
					<td width="10%"><c:if test="${not empty item.storicoTicket.allegatis }">
						<a
							href="visualizzaListaAllegati.do?ids=<c:out value="${item.storicoTicket.idStorico }"/>"
							target="_blank">Vedi allegati</a>
					</c:if></td>
				</tr>
			</c:when>
			<c:otherwise>
				<tr>
					<td width="10%"><fmt:formatDate value="${item.storicoTicket.dataModifica }"
						pattern="dd/MM/yyyy" /></td>
					<td width="10%"><fmt:formatDate value="${item.storicoTicket.dataModifica }"
						pattern="HH:mm" /></td>
					<td width="40%"><c:out value="${item.storicoTicket.prossimaAzione}"></c:out></td>
					<td width="30%"><c:out
						value="${item.storicoTicket.tickets.utentiByIdUtenteUltimaModifica.cognome}"></c:out></td>
					<td width="10%">					
						<c:if test="${item.modifiable && item.storicoTicket.tickets.utentiByIdUtenteUltimaModifica.idUtente==loginForm.utenti.idUtente}">
							<a href="modificaTicket.do?idTicket=<c:out value='${item.storicoTicket.tickets.idTicket }'/>&idStorico=<c:out value='${item.storicoTicket.idStorico }'/>&modifica=Y">modifica</a>
						</c:if>
					</td>
					<td width="10%"><c:if test="${not empty item.storicoTicket.allegatis }">
						<a
							href="visualizzaListaAllegati.do?ids=<c:out value="${item.storicoTicket.idStorico }"/>"
							target="_blank">Vedi allegati</a>
					</c:if></td>
				</tr>
			</c:otherwise>
		</c:choose>
	</c:forEach>
</table>
